package ro.pub.cs.client.settings;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class EditHomeworkDialog extends DialogBox implements ClickListener{
	private VerticalPanel layoutPanel = new VerticalPanel();
	
	private Button okButton = new Button("OK");
	private Button cancelButton = new Button("Cancel");
	
	private TextBox nameTextBox = new TextBox();
	private TextArea descriptionTextArea = new TextArea();
	
	public EditHomeworkDialog() {
		super(false, true);
		this.setText("Edit Homework");
		
		okButton.addClickListener(this);
		cancelButton.addClickListener(this);
		
		HorizontalPanel hPanel = new HorizontalPanel();
		hPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
		hPanel.add(okButton);
		hPanel.add(cancelButton);
		
		layoutPanel.setHorizontalAlignment(VerticalPanel.ALIGN_LEFT);
		layoutPanel.add(new HTML("Name:"));
		layoutPanel.add(nameTextBox);
		layoutPanel.add(new HTML("Description:"));
		layoutPanel.add(descriptionTextArea);
		layoutPanel.add(hPanel);
		
		this.setWidget(layoutPanel);
	}

	public void onClick(Widget sender) {
		if (sender == okButton) {
			this.hide();
		} else if (sender == cancelButton) {
			this.hide();
		}
		
	}
}
